package com.example.technologyintroandroid;

import sheep.game.Sprite;
import sheep.graphics.Image;

public class Helicopter extends Sprite{
	
	private int width, height;
	private final float speedX = 40, speedY = 30;
	
	public Helicopter(Image image, int width, int height){
		super(image);
		this.width = width;
		this.height = height;
		
		this.setPosition(width/2, height/2);
		this.setSpeed(-speedX, speedY);
	}
	
	@Override
	public void update(float dt) {
		super.update(dt);
		if(this.getPosition().getX()<=100){
			this.setSpeed(speedX, this.getSpeed().getY());
			this.setScale(-1, 1);
			this.setPosition(200, this.getPosition().getY());
		}
		if (this.getPosition().getX()>=width-70){
			this.setSpeed(-speedX, this.getSpeed().getY());
			this.setScale(1, 1);
			this.setPosition(width-75, this.getPosition().getY());
		}
		if(this.getPosition().getY()<=30){
			this.setSpeed(this.getSpeed().getX(), speedY);
		}
		if(this.getPosition().getY()>=height-70){
			this.setSpeed(this.getSpeed().getX(), -speedY);
		}
	}
}
